﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using Common.BaseLibrary.Authorization
@using DepartmentWork.Model
@model DepartmentWork.Model.ProjectDeskWorkTimeViewModel



<div class="page-header">
    <div class="pull-left">
        <ol class="breadcrumb visible-sm visible-md visible-lg">
            <li><a href="index.html"><i class="icon fa fa-home"></i>主页</a></li>
            <li class="active"><a href="#"><i class="fa fa-envelope"></i>加班管理</a></li>
        </ol>
    </div>
</div>


@{
    if (ViewBag.Flag == "True")
    {
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;@ViewBag.FlagInfo！</strong>
    </div>
    }
    if (ViewBag.Flag == "False")
    {
    <div class="alert alert-danger">
        <button type="button" class="close" data-dismiss="alert">×</button>
        <strong>&emsp;操作失败！</strong> @ViewBag.FlagInfo
    </div>
    }
}
<style>
   ul>.active {
       font-weight:bold
   }
   .bootstrap-select  {
       width: 100%;
   }
    
</style>


<script>
    function selcet() {
        //alert('a');
        //debugger;
        document.getElementById("YesSelcet").style.display = "";
        document.getElementById("NoSelcet").style.display = "none";
        $.ajax({
            type: "POST",
            //url: "/KSManager/DepartmentArea/Overtime/SelcetS",
            url:'@Url.Action("SelcetS","Overtime",new{area="DepartmentArea"})',
            data: "NameId=" + $("#select_ID").val() + "&&BTime=" + $("#selcet_text_BTime_id").val() + "&&DTime=" + $("#selcet_text_DTime_id").val(),
            error: function () { alert("服务器出错！"); },
            success: function (data) {

                createShowingTable(data);

            }
        });
    }

    function createShowingTable(data) {
        var tableStr = "<hr style='width:100%; height:2px;border:none;border-top:2px solid #185598;'/>" + "<table class='table table-hover'>";
        tableStr = tableStr
        + "<thead>"
        + "<tr>"
        + "<th style='text-align: center'>加班人</th>"
        + "<th style='text-align: center'>申请时间</th>"
        + "<th style='text-align: center'>加班日期</th>"
        + "<th style='text-align: center'>加班时间</th>"
        + "<th style='text-align: center'>加班时长</th>"
        + "<th style='text-align: center'>本月加班累计总时长</th>"
        + "<th style='text-align: center'>本月加班次数</th>"
        + "<th style='text-align: center'>审批人</th>"
        + "</tr>"
        + "</thead>";
        var len = data.length;
        for (var i = 0; i < len; i++) {
            tableStr = tableStr
            + "<tr>"
            + "<td style='text-align: center'>" + data[i]["worktime_name"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_time_selcet"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_day"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_time_time"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_duration"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_howduration"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_quantity"] + "</td>"
            + "<td style='text-align: center'>" + data[i]["worktime_overname"] + "</td>"
            + "</tr>";
        }
        $("#xxx").html(tableStr);
    }

</script>





<div class="row">
    <div class="col-lg-12">
        <div class="panel">
            <div class="panel-heading bk-bg-primary">
                <h6><i class="fa fa-table red"></i><span class="break"></span>加班列表</h6>
                @{
                    if (ViewBag.anonymity == true)
                    {
                    <div class="panel-actions">
                        <a data-toggle="modal" data-target="#myModal" class="bk-margin-5 btn btn-default  btn-sm" style="background-color: #ECEDF0">&nbsp;&nbsp;我要加班&nbsp;&nbsp;</a>
                    </div>
                    }
                }

            </div>
            <div class="panel-body">
                <div class="tabs">
                    <ul class="nav nav-tabs">
                        @{
                            if (ViewBag.anonymity == true)
                            {
                            <li class="active">
                                <a href="#oneself"  style="color:black" data-toggle="tab">个人加班记录</a>
                            </li>
                            }
                        }
                        @{
                            if (ViewBag.IsAdmin == true && ViewBag.anonymity == true)
                            {
                            <li class="">
                                <a href="#all"  style="color:black" data-toggle="tab">全员加班记录与统计</a>
                            </li>
                            <li class="">
                                <a href="#dai"  style="color:black" data-toggle="tab">待审批</a>
                            </li>
                            }
                        }
                        @{
                            if (ViewBag.IsAdmin == true && ViewBag.anonymity == false)
                            {
                            <li class="">
                                <a href="#all"  style="color:black" data-toggle="tab">全员加班记录与统计</a>
                            </li>
                            }
                        }
                    </ul>
                    <div class="tab-content">
                        @if (ViewBag.anonymity == true)
                        {
                            <div id="oneself" class="tab-pane active">
                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover">
                                            <thead>
                                                <tr>
                                                    <th style="text-align: center">加班人</th>
                                                    <th style="text-align: center">申请时间</th>
                                                    <th style="text-align: center">加班日期</th>
                                                    <th style="text-align: center">加班时间</th>
                                                    <th style="text-align: center">加班时长(小时)</th>
                                                    <th style="text-align: center">审批结果</th>
                                                    <th style="text-align: center">审批人</th>
                                                    <th style="text-align: center">相关操作</th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                                @if (ViewBag.ownWorktime != null)
                                                {
                                                    foreach (ProjectDeskWorkTimeViewModel item in ViewBag.ownWorktime)
                                                    {
                                                    <tr>
                                                        <td style="text-align: center;color:black">@item.worktime_name</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time.ToString("yyyy-MM-dd")</td>

                                                        <td style="text-align: center;color:black">@Convert.ToDateTime(item.worktime_day).ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time_time</td>

                                                        <td style="text-align: center;color:black">@item.worktime_duration 小时</td>
                                                        @if (item.worktime_status == 1)
                                                        {
                                                                <td style="text-align: center;color:black">通过</td>
                                                            <td style="text-align: center;color:black">@item.worktime_overname</td>
                                                            <td></td>
                                                        }

                                                        @if (item.worktime_status == 0)
                                                        {
                                                            <td style="text-align: center;color:black">等待审批</td>
                                                             <td style="text-align: center;color:black"></td>
                                                            <td style="text-align: center;color:black">
                                                                <a onclick="getid('@item.worktime_id')" data-toggle="modal" data-target="#overtime" style="color:blue">&nbsp;&nbsp;编辑&nbsp;&nbsp;</a>
                                                                <a onclick="deleteid('@item.worktime_id')" data-toggle="modal" data-target="#Delete" style="color:red">&nbsp;&nbsp;删除&nbsp;&nbsp;</a>
                                                            </td>
                                                        }
                                                        @if (item.worktime_status == 3)
                                                        {
                                                             <td style="text-align: center;color:black">被驳回</td>   
                                                              <td style="text-align: center;color:black">@item.worktime_overname</td>  
                                                             <td></td>        
                                                        }

                                                    </tr>
                                                    }
                                                }
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="bk-margin-5 btn-group" style="float: right">
                                        @Html.ShowPageNavigate((int)ViewData["pageIndexExecute"], (int)ViewData["pageSizeExecute"], (int)ViewData["totalExecute"])
                                    </div>
                                </div>
                            </div>
                        }
                        @if (ViewBag.IsAdmin == true && ViewBag.anonymity == true)
                        {
                            <div id="all" class="tab-pane updateProfile">
                                  <br />
                                <div style="text-align:center">
                                    <label>姓名：</label>
                                     <select name="selectname_ID" id="select_ID">
                                     <option value="1">全部</option>
                               @{
                              List<UserInfoViewModel> userListt = (List<UserInfoViewModel>)TempData["UserList"];
                                    if (userListt != null)
                                    {
                                        for (int i = 0; i < userListt.Count(); i++)
                                        {
                                            var item = userListt[i];
                                    <option value="@item.UserId">@item.UserName</option>
                                        }
                                    }
                                }
                          </select>
                                     <label>时间：</label>
                                     <div class="input-append date" style="display:inline-block"   id="selcet_BTime" data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                                <input id="selcet_text_BTime_id"  name="selcet_text_BTime" size="10" type="text" value="@DateTime.Now.ToString("yyyy-MM-dd")"> 
                            <span class="add-on"><i  class="icon-th"></i></span>
                       </div>
                                     <label style="display:inline-block" >-</label>
                                      <div  class="input-append date"  style="display:inline-block"  id="selcet_DTime"  data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                                <input  id="selcet_text_DTime_id"  name="selcet_text_DTime" size="10" type="text"  value="@DateTime.Now.ToString("yyyy-MM-dd")">
                             <span class="add-on"><i class="icon-th"></i></span>
                        </div>
                                     <button onclick="selcet()">搜索</button>
                            </div>
                                <div id="YesSelcet" style="display:none" class="panel-body">
                                    <div id="xxx" class="table-responsive"></div>
                                    <div class="bk-margin-5 btn-group" style="float: right">
                                        @Html.ShowPageNavigate((int)ViewData["pageIndexExecute"], (int)ViewData["pageSizeExecute"], (int)ViewData["totalFinish"])
                                    </div>
                                </div>
                                <div id="NoSelcet" class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover">
                                            <thead>
                                                <tr>
                                                    <th style="text-align: center">加班人</th>
                                                    <th style="text-align: center">申请时间</th>
                                                    <th style="text-align: center">加班日期</th>
                                                    <th style="text-align: center">加班时间</th>
                                                    <th style="text-align: center">加班时长</th>
                                                    <th style="text-align: center">本月加班累计总时长</th>
                                                    <th style="text-align: center">本月加班次数</th>
                                                    <th style="text-align: center">审批人</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                                @if (ViewBag.allWorktime != null)
                                                {
                                                    foreach (ProjectDeskWorkTimeViewModel item in ViewBag.allWorktime)
                                                    {
                                                    <tr>
                                                        <td style="text-align: center;color:black">@item.worktime_name</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time.ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@Convert.ToDateTime(item.worktime_day).ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time_time</td>
                                                        <td style="text-align: center;color:black">@item.worktime_duration</td>
                                                        <td style="text-align: center;color:black">@item.worktime_howduration</td>
                                                        <td style="text-align: center;color:black">@item.worktime_quantity</td>
                                                         @if (item.worktime_status == 1)
                                                         {
                                                            <td style="text-align: center;color:black">@item.worktime_overname</td>
                                                         }
                                                        @if (item.worktime_status == 0)
                                                        {
                                                            <td></td>
                                                        }
                                                    </tr>
                                                    }
                                                }
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="bk-margin-5 btn-group" style="float: right">
                                        @Html.ShowPageNavigate((int)ViewData["pageIndexExecute"], (int)ViewData["pageSizeExecute"], (int)ViewData["totalFinish"])
                                    </div>
                                </div>
                            </div>
                            <div id="dai" class="tab-pane updateProfile">
                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover">
                                            <thead>
                                                <tr>
                                                    <th style="text-align: center">加班人</th>
                                                    <th style="text-align: center">申请时间</th>
                                                    <th style="text-align: center">加班日期</th>
                                                    <th style="text-align: center">加班时间</th>
                                                    <th style="text-align: center">加班时长</th>
                                                    <th style="text-align: center">审批操作</th>

                                                </tr>
                                            </thead>

                                            <tbody>
                                                @if (ViewBag.daiWorktime != null)
                                                {
                                                    foreach (ProjectDeskWorkTimeViewModel item in ViewBag.daiWorktime)
                                                    {
                                                    <tr>
                                                        <td style="text-align: center;color:black">@item.worktime_name</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time.ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@Convert.ToDateTime(item.worktime_day).ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time_time</td>
                                                        <td style="text-align: center;color:black">@item.worktime_duration</td>
                                                        <td style="text-align: center;color:black">
                                                            <a onclick="setid('@item.worktime_id')" data-toggle="modal" data-target="#xiangqing" style="color:blue">&nbsp;&nbsp;详情&nbsp;&nbsp;</a>
                                                            <a onclick="daiid('@item.worktime_id')" data-toggle="modal" data-target="#shenpi" style="color:blue">&nbsp;&nbsp;审批&nbsp;&nbsp;</a>
                                                        </td>
                                                    </tr>
                                                    }
                                                }
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="bk-margin-5 btn-group" style="float: right">
                                        @Html.ShowPageNavigate((int)ViewData["pageIndexExecute"], (int)ViewData["pageSizeExecute"], (int)ViewData["totalFinish"])
                                    </div>
                                </div>
                            </div>
                        }

@* 匿名用户看到的全员*@
                        @if (ViewBag.IsAdmin == true && ViewBag.anonymity == false)
                        {
                            <div id="all" class="tab-pane active">
                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover">
                                            <thead>
                                                <tr>
                                                    <th style="text-align: center">加班人</th>
                                                    <th style="text-align: center">申请时间</th>
                                                    <th style="text-align: center">加班日期</th>
                                                    <th style="text-align: center">加班时间</th>
                                                    <th style="text-align: center">加班时长</th>
                                                 
                                                    <th style="text-align: center">本月加班累计总时长</th>
                                                    <th style="text-align: center">本月加班次数</th>
                                                       <th style="text-align: center">审批人</th>
                                                </tr>
                                            </thead>

                                            <tbody>
                                                @if (ViewBag.allWorktime != null)
                                                {
                                                    foreach (ProjectDeskWorkTimeViewModel item in ViewBag.allWorktime)
                                                    {
                                                    <tr>
                                                        <td style="text-align: center;color:black">@item.worktime_name</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time.ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@Convert.ToDateTime(item.worktime_day).ToString("yyyy-MM-dd")</td>
                                                        <td style="text-align: center;color:black">@item.worktime_time_time</td>
                                                        <td style="text-align: center;color:black">@item.worktime_duration</td>
                                                
                                                        <td style="text-align: center;color:black">@item.worktime_howduration</td>
                                                        <td style="text-align: center;color:black">@item.worktime_quantity</td>

                                                        <td style="text-align: center;color:black">@item.worktime_overname</td>
                                                    </tr>
                                                    }
                                                }
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="bk-margin-5 btn-group" style="float: right">
                                        @Html.ShowPageNavigate((int)ViewData["pageIndexExecute"], (int)ViewData["pageSizeExecute"], (int)ViewData["totalFinish"])
                                    </div>
                                </div>
                            </div>
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>





@*编辑ajax*@
<script>
    function getid(bugId) {
        $.ajax({
            type: "POST",
            //url: "/KSManager/DepartmentArea/Overtime/OvertimeUpdat",
            url:'@Url.Action("OvertimeUpdat","Overtime",new{area="DepartmentArea"})',
            data: "roleId=" + bugId,
            error: function () { alert("服务器出错！"); },
            success: function (data) {
                $("#worktime_cause").val(data["worktime_cause"]);
                $("#worktime_duration").val(data["worktime_duration"]);
                $("#compile_worktime_id").val(data["worktime_id"]);
            }
        });
    }
</script>

@*删除ajax*@
<script>
    function deleteid(bugId) {

        $.ajax({
            type: "POST",
            //url: "/KSManager/DepartmentArea/Overtime/documentDelete",
            url:'@Url.Action("documentDelete","Overtime",new{area="DepartmentArea"})',
            data: "roleId=" + bugId,
            error: function () { alert("服务器出错！"); },
            success: function (data) {
                $("#delete_worktime_id").val(data["worktime_id"]);
            }
        });
    }

</script>


@*审批ajax*@
<script>
    function daiid(bugId) {
        $.ajax({
            type: "POST",
            //url: "/KSManager/DepartmentArea/Overtime/documentDelete",
            url:'@Url.Action("documentDelete","Overtime",new{area="DepartmentArea"})',
            data: "roleId=" + bugId,
            error: function () { alert("服务器出错！"); },
            success: function (data) {
                $("#dai_worktime_id").val(data["worktime_id"]);
            }
        });
    }
</script>



<!-- 新增（Modal） -->

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <link href="~/Assets/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
    <script src="~/Assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
    <link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet" />
    <link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker-theme.css" rel="stylesheet" />
    <script src="~/Assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script src="~/Assets/plugins/chosen/chosen.jquery.min.js"></script>
    <script src="~/Assets/js/pages/form-elements.js"></script>
    <script>
        $(document).ready(function () {
            $("#overtime_id").validate({
                rules: {
                    tb_leave_worktime_duration: { required: true, digits: true, range: [1, 99] },
                    tb_worktime_cause: { required: true },
                },
                messages: {
                    tb_leave_worktime_duration: { required: "加班时长不能为空", digits: "加班时长只能是整数", range: "加班时长只能是1-99的整数" },
                    tb_worktime_cause: { required: "事由不能为空" },
                },
                errorPlacement: function (error, element) {
                    error.appendTo(element.next("span.worktime_duration_class"));
                    error.appendTo(element.next("span.worktime_cause_class"));
                },
            });
            $("span.worktime_duration_class").css("color", "red");
            $("span.worktime_cause_class").css("color", "red");
        })

        window.onload = function () {
            //$("#datetimepicker").datepicker();
            $("#datetimepicker").datepicker({
                autoclose: true,
                pickerPosition: "bottom-right"
            });
            $("#datetimepickerr").datepicker({
                autoclose: true,
                pickerPosition: "bottom-right"
            });

            $("#selcet_BTime").datepicker({
                autoclose: true,
                pickerPosition: "bottom-right"
            });


            $("#selcet_DTime").datepicker({
                autoclose: true,
                pickerPosition: "bottom-right"
            });
        };
    </script>
    <script>
        
        function SSubmit() {
            //alert($("#worktime_timeDD").val());
            //alert($("#worktime_timeKK").val());
            //var a1 = $("#worktime_timeDD").val();
            //var a2 = $("#worktime_timeKK").val();
            //alert(a1<a2);
            if ($("#worktime_timeDD").val() <= $("#worktime_timeKK").val())
            {
                $("#worktime_time").css("color", "red");
                $("#worktime_time").text("加班结束时间不能小于等于开始时间");
                return false;
            }
            else {
                $("#overtime_id").submit();
            }
        }

    </script>
  
    <style>
        .btn-default {
            color: #333;
            background-color: #FFF;
            border-color: #CCC;
            height: 34px;
        }
    </style>
    <div class="modal-dialog">
        <div class="modal-content">
            <form id="overtime_id" action="@Url.Action("ApplyForWorkTime", "Overtime", new { area = "DepartmentArea" })" method="POST">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel1">加班申请</h4>
                </div>
                <div id="div_CreateProject1" class="modal-body">
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">申请人:</label>
                        <div class="col-md-9">
                            <input id="text-input1" value="@ViewBag.myName" readonly="true" style="border-color: cornflowerblue" name="tb_worktime_name" class="form-control" placeholder="Text" type="text">
                        </div>
                    </div>
                    <br />


                    <div class="row">
                        <label class="col-md-3 control-label">加班日期：</label>
                        <div class="col-md-9">
                            <div class="input-append date" id="datetimepicker" data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                                <input name="tb_DeadTime" style="border-color: cornflowerblue" class="form-control" size="16" type="text" value="@DateTime.Now.ToString("yyyy-MM-dd")">
                                <span class="add-on"><i class="icon-th"></i></span>
                            </div>
                            <span class="span_DevelopDescription"></span>
                        </div>
                    </div>
                    <br />


                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">加班时间:</label>
                        <div class="col-md-9" style="height: 100%">
                            <select name="select_worktime_timeK" id="worktime_timeKK" style="width: 30%; height: 30px">
                                <option value="00">0:00</option>
                                <option value="01">1:00</option>
                                <option value="02">2:00</option>
                                <option value="03">3:00</option>
                                <option value="04">4:00</option>
                                <option value="05">5:00</option>
                                <option value="06">6:00</option>
                                <option value="07">7:00</option>
                                <option value="08">8:00</option>
                                <option value="09">9:00</option>
                                <option value="10">10:00</option>
                                <option value="11">11:00</option>
                                <option value="12">12:00</option>
                                <option value="13">13:00</option>
                                <option value="14">14:00</option>
                                <option value="15">15:00</option>
                                <option value="16">16:00</option>
                                <option value="17">17:00</option>
                                <option value="18">18:00</option>
                                <option value="19">19:00</option>
                                <option value="20">20:00</option>
                                <option value="21">21:00</option>
                                <option value="22">22:00</option>
                                <option value="23">23:00</option>
                            </select>
                            <label>-</label>
                            <select name="select_worktime_timeD" id="worktime_timeDD" style="width: 30%; height: 30px">
                                <option value="00">0:00</option>
                                <option value="01">1:00</option>
                                <option value="02">2:00</option>
                                <option value="03">3:00</option>
                                <option value="04">4:00</option>
                                <option value="05">5:00</option>
                                <option value="06">6:00</option>
                                <option value="07">7:00</option>
                                <option value="08">8:00</option>
                                <option value="09">9:00</option>
                                <option value="10">10:00</option>
                                <option value="11">11:00</option>
                                <option value="12">12:00</option>
                                <option value="13">13:00</option>
                                <option value="14">14:00</option>
                                <option value="15">15:00</option>
                                <option value="16">16:00</option>
                                <option value="17">17:00</option>
                                <option value="18">18:00</option>
                                <option value="19">19:00</option>
                                <option value="20">20:00</option>
                                <option value="21">21:00</option>
                                <option value="22">22:00</option>
                                <option value="23">23:00</option>
                            </select>
                            <div><span id="worktime_time"></span></div>
                           
                        </div>
                    </div>
                    <br />



                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">加班事由：</label>
                        <div class="col-md-9">
                            <textarea id="textarea-input" name="tb_worktime_cause" rows="5" class="form-control" placeholder="Content.."></textarea>
                            <span class="worktime_cause_class"></span>
                        </div>
                    </div>
                    <br />


                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">审批人：</label>
                        <div class="col-md-9">
                            <select name="select_WorkLeader" id="select_ProjectLeader" class="form-control selectpicker">
                                @{
                                    List<UserInfoViewModel> userList = (List<UserInfoViewModel>)TempData["User"];
                                    if (userList != null)
                                    {
                                        for (int i = 0; i < userList.Count(); i++)
                                        {
                                            var item = userList[i];
                                            if (userList[i] == userList[0])
                                            {
                                    <option selected="selected" value="@item.UserId">@item.UserName</option>
                                            }
                                            else
                                            {
                                    <option value="@item.UserId">@item.UserName</option>
                                            }
                                        }
                                    }
                                }
                            </select>
                        </div>
                    </div>
                    <br />



                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="button" value="申请" onclick="SSubmit()" class="btn btn-primary" />
                </div>
            </form>
        </div>

    </div>

</div>


<!-- 编辑（Modal） -->

<div class="modal fade" id="overtime" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <link href="~/Assets/plugins/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
    <script src="~/Assets/plugins/bootstrap-select/bootstrap-select.min.js"></script>
    <link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet" />
    <link href="~/Assets/plugins/bootstrap-datepicker/css/datepicker-theme.css" rel="stylesheet" />
    <script src="~/Assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
    <script src="~/Assets/plugins/chosen/chosen.jquery.min.js"></script>
    <script src="~/Assets/js/pages/form-elements.js"></script>

    <script>

        $(document).ready(function () {
            $("#overtime_idd").validate({
                rules: {
                    tb_leave_worktime_duration: { required: true, digits: true, range: [1, 99] },
                    tb_worktime_cause: { required: true },
                },
                messages: {
                    tb_leave_worktime_duration: { required: "加班时长不能为空", digits: "加班时长只能是整数", range: "加班时长只能是1-99的整数" },
                    tb_worktime_cause: { required: "事由不能为空" },
                },
                errorPlacement: function (error, element) {
                    error.appendTo(element.next("span.worktime_duration_class"));
                    error.appendTo(element.next("span.worktime_cause_class"));
                },
            });
            $("span.worktime_duration_class").css("color", "red");
            $("span.worktime_cause_class").css("color", "red");
        })
 
    </script>
    <script>
        function Submit() {
            if ($("#select_tb_worktime_timeD").val() <= $("#select_tb_worktime_timeK").val()) {
                $("#worktime_timekd").css("color", "red");
                $("#worktime_timekd").text("加班结束时间不能小于等于开始时间");
                return false;
            }
            else {
                $("#overtime_idd").submit();
            }
        }
    </script>
    <style>
        .btn-default {
            color: #333;
            background-color: #FFF;
            border-color: #CCC;
            height: 34px;
        }
    </style>
    <div class="modal-dialog">
        <div class="modal-content">
            <form id="overtime_idd" action="@Url.Action("updat_worktime", "Overtime", new { area = "DepartmentArea" })" method="POST">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel2">加班申请</h4>
                </div>
                <div id="div_CreateProject3" class="modal-body">
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">申请人:</label>
                        <div class="col-md-9">
                            <input id="text-input" value="@ViewBag.myName" readonly="true" style="border-color: cornflowerblue" name="tb_worktime_name" class="form-control" placeholder="Text" type="text">
                            <input type="hidden" id="compile_worktime_id" name="td_worktime_id" value="" />
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label">加班日期：</label>
                        <div class="col-md-9">
                            <div class="input-append date" id="datetimepickerr" data-date="@DateTime.Now.ToString("yyyy-MM-dd")" data-date-format="yyyy-mm-dd">
                                <input name="tb_worktime_DeadTime" style="border-color: cornflowerblue" class="form-control" size="16" type="text" value="@DateTime.Now.ToString("yyyy-MM-dd")">
                                <span class="add-on"><i class="icon-th"></i></span>
                            </div>
                            <span class="span_DevelopDescription"></span>
                        </div>
                    </div>
                    <br />
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">加班时间:</label>
                        <div class="col-md-9" style="height: 100%">
                            <select name="tb_worktime_timeK" id="select_tb_worktime_timeK" style="width: 30%; height: 30px">
                                <option value="00">0:00</option>
                                <option value="01">1:00</option>
                                <option value="02">2:00</option>
                                <option value="03">3:00</option>
                                <option value="04">4:00</option>
                                <option value="05">5:00</option>
                                <option value="06">6:00</option>
                                <option value="07">7:00</option>
                                <option value="08">8:00</option>
                                <option value="09">9:00</option>
                                <option value="10">10:00</option>
                                <option value="11">11:00</option>
                                <option value="12">12:00</option>
                                <option value="13">13:00</option>
                                <option value="14">14:00</option>
                                <option value="15">15:00</option>
                                <option value="16">16:00</option>
                                <option value="17">17:00</option>
                                <option value="18">18:00</option>
                                <option value="19">19:00</option>
                                <option value="20">20:00</option>
                                <option value="21">21:00</option>
                                <option value="22">22:00</option>
                                <option value="23">23:00</option>
                            </select>
                            <label>-</label>
                            <select name="tb_worktime_timeD" id="select_tb_worktime_timeD" style="width: 30%; height: 30px">
                                <option value="00">0:00</option>
                                <option value="01">1:00</option>
                                <option value="02">2:00</option>
                                <option value="03">3:00</option>
                                <option value="04">4:00</option>
                                <option value="05">5:00</option>
                                <option value="06">6:00</option>
                                <option value="07">7:00</option>
                                <option value="08">8:00</option>
                                <option value="09">9:00</option>
                                <option value="10">10:00</option>
                                <option value="11">11:00</option>
                                <option value="12">12:00</option>
                                <option value="13">13:00</option>
                                <option value="14">14:00</option>
                                <option value="15">15:00</option>
                                <option value="16">16:00</option>
                                <option value="17">17:00</option>
                                <option value="18">18:00</option>
                                <option value="19">19:00</option>
                                <option value="20">20:00</option>
                                <option value="21">21:00</option>
                                <option value="22">22:00</option>
                                <option value="23">23:00</option>
                            </select>
                            <div><span id="worktime_timekd"></span></div>
                        </div>
                    </div>
                    <br />





                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">加班事由：</label>
                        <div class="col-md-9">
                            <textarea id="worktime_cause" name="tb_worktime_cause" rows="5" class="form-control" placeholder="Content.."></textarea>
                            <span class="worktime_cause_class"></span>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">审阅人：</label>
                        <div class="col-md-9">
                            <select name="tb_WorkLeader" id="tb_ProjectLeader" class="form-control selectpicker">
                                @{
                                    List<UserInfoViewModel> updete = (List<UserInfoViewModel>)TempData["User"];
                                    if (updete != null)
                                    {
                                        for (int i = 0; i < updete.Count(); i++)
                                        {
                                            var item = updete[i];
                                            if (updete[i] == userList[0])
                                            {
                                    <option selected="selected" value="@item.UserId">@item.UserName</option>
                                            }
                                            else
                                            {
                                    <option value="@item.UserId">@item.UserName</option>
                                            }
                                        }
                                    }
                                }
                            </select>
                        </div>
                    </div>
                    <br />



                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="button" value="修改" onclick="Submit()" class="btn btn-primary" />
                </div>
            </form>
        </div>

    </div>

</div>

<!-- 删除记录 模态框（Modal） -->
<div class="modal fade" id="Delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
            </div>
            <form enctype="multipart/form-data" action="@Url.Action("delete_Worktime", "Overtime", new { area = "DepartmentArea" })" method="POST" >

                <div class="modal-body">
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">确定删除此项记录么</label>
                        <input type="hidden" id="delete_worktime_id" name="delete_worktime_idd" value="" />
                    </div>
                    <br />
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="submit" value="确定" class="btn btn-primary" />
                </div>

            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>






<!-- 审批操作 模态框（Modal） -->

@*<div class="modal fade" id="shenpi" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
            </div>
            <form enctype="multipart/form-data" action="@Url.Action("S_worktime", "Overtime", new { area = "DepartmentArea" })", method="POST" >

                <div class="modal-body">
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">确定审批此加班么？</label>
                        <input type="hidden" id="dai_worktime_id" name="dai_worktime_idd" value="" />
                    </div>
                    <br />
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="submit" value="确定" class="btn btn-primary" />
                </div>

            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>*@


<div class="modal fade" id="shenpi" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabell">审批</h4>
            </div>
            <form action="@Url.Action("S_worktime", "Overtime", new { area = "DepartmentArea" })" method="POST">
                <div class="modal-body">
                <input type="hidden" id="dai_worktime_id" name="dai_worktime_idd" value="" />
                    <div class="row">
                        <br />
                        <label class="col-md-3 control-label">工作状态操作：</label>
                        <div class="col-md-9">

                            <select name="select_WorkTimeStatus" class="form-control select2">
                                <option value="1">通过</option>
                                <option value="3">驳回</option>
                            </select>
                        </div>
                    </div>

                    <br />

                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                    <input type="submit" class="btn btn-primary" value="提交更改" />
                </div>
            </form>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal -->
</div>




<!-- 加班详情 模态框（Modal） -->
<script>
    function setid(bugId) {
        $.ajax({
            type: "POST",
            //url: "/KSManager/DepartmentArea/Overtime/OvertimeUpdat",
            url:'@Url.Action("OvertimeUpdat","Overtime",new{area="DepartmentArea"})',
            data: "roleId=" + bugId,
            error: function () { alert("服务器出错！"); },
            success: function (data) {
                $("#compile_worktime_cause").text(data["worktime_cause"]);
                $("#worktime_duration").text(data["worktime_duration"]);
                $("#compile_worktime_name").text(data["worktime_name"]);
                $("#compile_worktime_day").text(data["worktime_day"]);
                $("#compile_worktime_time_time").text(data["worktime_time_time"]);


            }
        });
    }
</script>


<div class="modal fade" id="xiangqing" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <form id="overtime_id_xiangqing" action="@Url.Action("updat_worktime", "Overtime", new { area = "DepartmentArea" })" method="POST">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">加班详情</h4>
                </div>
                <div id="div_CreateProject" class="modal-body">
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">申请人:</label>
                        <div class="col-md-9">
                            <label id="compile_worktime_name" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label">加班日期：</label>
                        <div class="col-md-9">
                            <label id="compile_worktime_day" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>

                        </div>
                    </div>
                    <br />
                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">加班时间:</label>
                        <div class="col-md-9" style="height: 100%">
                            <label id="compile_worktime_time_time" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                        </div>
                    </div>
                    <br />

                    <div class="row">
                        <label class="col-md-3 control-label" for="text-input">加班事由：</label>
                        <div class="col-md-9">
                            <label id="compile_worktime_cause" style="width: 100%" class="col-md-8 control-label" for="text-input"></label>
                        </div>
                    </div>
                    <br />


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">
                        关闭
                    </button>
                </div>
            </form>
        </div>

    </div>
</div>



